package com.suncaper.tddmall.service;

import com.suncaper.tddmall.common.model.User;
import com.suncaper.tddmall.common.model.UserExample;
import com.suncaper.tddmall.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserAccountServiceImpl implements UserAccountService {
    @Autowired
    UserMapper userMapper;
    @Override
    public User searchUserInfo(String userId) {
        User user = userMapper.selectByPrimaryKey(userId);
        return user;
    }

    @Override
    public void updateUserInfoByUserId(User user) {
        UserExample userExample = new UserExample();
        userExample.createCriteria().andUserIdEqualTo(user.getUserId());
        userMapper.updateByExampleSelective(user,userExample);
    }

}
